<template>
	<view class="service">
		<image :show-menu-by-longpress="true" class="pic" :src="kfewm" mode=" widthFix"></image>

		<view class="tips">
			长按识别添加客服二维码
		</view>
		<view @click="callPhone" class="tips tell">
			点击联系电话：{{tell || ''}}
		</view>
	</view>
</template>

<script>
	import {
		getConfigKey

	} from '@/api/user'
	export default {
		data() {
			return {
				kfewm: '',
				kfedh: '',
				tell: ''
			}
		},
		onLoad() {
			this.getConfigFn()
		},
		methods: {
			callPhone() {
				uni.makePhoneCall({
					phoneNumber: this.tell, // 替换为你要拨打的电话号码
					success: () => {
						console.log('拨打电话成功！');
					},
					fail: () => {
						console.error('拨打电话失败！');
					}
				});
			},
			getConfigFn() {
				getConfigKey('kefu_ercode')
					.then(res => {
						let resDate = res?.data ? JSON.parse(res?.data) : ''
						this.kfewm = resDate?.kfErcode;
						this.tell = resDate?.tell;
					})
					.catch(err => {

					})
			},
		}
	}
</script>

<style scoped>
	.pic {
		width: 500rpx;
		height: 500rpx;
		/* width: 80%; */
		display: block;
		margin: 100rpx auto 10px;
	}

	.tips {
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #333333;
		padding: 20rpx 0;
		text-align: center;
	}
</style>